//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_CDISPLAY_H__
#define __ELASTOS_CDISPLAY_H__

#include <elasys_server.h>
#include <ddk.h>
#include <driver.h>
#include <display.h>
#include <grafixcomm.h>

EXTERN_C ECode SetScreenSize(
        /* [in] */ Int32 width,
        /* [in] */ Int32 height);

typedef ECode (*displayFunc)(
        /* [in] */ Address srcBuffer,
        /* [in] */ Int32 srcX,
        /* [in] */ Int32 srcY,
        /* [in] */ Int32 srcWidth,
        /* [in] */ Int32 srcHeight,
        /* [in] */ Int32 srcPitch,
        /* [in] */ Int32 dstX,
        /* [in] */ Int32 dstY,
        /* [in] */ Int32 orientation);

EXTERN_C ECode AddDisplayLoadCallback(
        /* [in] */ displayFunc load);

class CDisplay : public CDeviceDriver
{
public:
    ~CDisplay();

    ECode constructor();

    CARAPI Read(
        /* [in] */ Int64 offset,
        /* [in] */ Int32 bytesToRead,
        /* [out] */ MemoryBuf* pBuffer,
        /* [out] */ IEvent** ppCompletionEvent) {
        return E_NOT_IMPLEMENTED;
    }

    CARAPI Write(
        /* [in] */ Int64 offset,
        /* [in] */ const MemoryBuf &buffer,
        /* [out] */ Int32* pBytesWritten,
        /* [out] */ IEvent** ppCompletionEvent) {
        return E_NOT_IMPLEMENTED;
    }

    CARAPI Control(
        /* [in] */ Handle32 controlCode,
        /* [in] */ const MemoryBuf &inBuffer,
        /* [out] */ MemoryBuf* pOutBuffer,
        /* [out] */ IEvent** ppCompletionEvent);

    virtual void Dispose(){}

public:
    Address m_frameBuffer;
    displayFunc m_renderFunc;
};

#endif // __ELASTOS_DISPLAY_H__
